package cn.admin.service.impl;

import cn.admin.dao.AdminMapper;
import cn.admin.entity.Admin;
import cn.admin.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: 毛苏宇
 * @Description: You can do it!
 * @Date: Create in 11:32 2019/3/23
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class AdminServiceImpl implements AdminService {

    @Autowired private AdminMapper adminMapper;

    @Override
    public Admin login(Admin admin) {
        return adminMapper.findAdmin(admin);
    }

    @Override
    public boolean addAdmin(Admin admin) {
        return adminMapper.insertAdmin(admin)==1?true:false;
    }

    @Override
    public boolean adminIsExist(String admin_number) {
        return adminMapper.findAdminCountByNum(admin_number)>=1?true:false;
    }
}
